package com.aaa.dem1101;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/1  13:15
 */
public class Join {
    public static void main(String[] args) throws InterruptedException {
        JoinDemo joinDemo = new JoinDemo();
        joinDemo.start();
        //whj允许joinDemo下加入，只有joinDemo线程执行完毕后主线程才会执行
        joinDemo.join();
        for (int i = 0; i < 10; i++) {
            System.out.println("whj**"+i);
        }
    }
}
class JoinDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+"---"+i);
        }
    }
}
